package com.sky.service.impl;

import com.sky.constant.StatusConstant;
import com.sky.result.Result;
import com.sky.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @BelongsProject: sky-take-out
 * @Author: XieMingHui
 * @CreateTime: 2023-11-21  17:08
 * @Description: 店铺数据处理层
 * @Version: 1.0
 */
@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Override
    public Result<Integer> shopStart() {
        String s = stringRedisTemplate.opsForValue().get(StatusConstant.SHOP_START_KYE);
        return Result.success(Integer.parseInt(s));
    }

    @Override
    public Result<String> setShopStart(String status) {
        stringRedisTemplate.opsForValue().set(StatusConstant.SHOP_START_KYE,status);
        return Result.success("操作成功");
    }
}
